
class Jakesdots

  module Vimrc

    class Bundle < Dot
      def format
        "Bundle '#{value}'"
      end
    end

  end


  dot :vimrc do

    make_line_command(:bundle, Vimrc::Bundle)

    group :before do
      filetype 'off'
    end

    group :plugin do
      group :manager do
        setinc :rtp, '~/.vim/bundle/vundle'
        call 'vundle#rc()'
        bundle 'gmarik/vundle'
        bundle 'kien/ctrlp.vim'
        bundle 'tpope/vim-fugitive'
        bundle 'tpope/vim-surround'
        bundle 'tpope/vim-repeat'
        bundle 'altercation/vim-colors-solarized'
      end
      filetype 'on'
    end

    ######
    # Maps
    map_movement "'", "`"
    map_movement "g'", "'"
    map_movement "-", "^"
    map_movement "g-", "$"
    nmap :q, 'cw'
    nmap :Q, 'cW'
    nmap '<CR>', 'c%'


    # m for 'macro'
    noremap '<Leader>m', 'q'

    noremap ';', ':'
    nnoremap '<Space>', '.+'
    remove :inoremap, :jj
    inoremap :jh, '<Esc>'

    # Break apart line at cursor
    nnoremap_silent '\\', 'i<CR><Esc>:let _s=@/<CR>k:s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>+'

    # Slightly better smartindent
    nnoremap :S, :ddko

    # Highlight this searh
    nnoremap_silent 'g/', ':set hlsearch<CR>/'
    nnoremap_silent 'g?', ':set hlsearch<CR>?'

    # Underline with = or -
    nmap '<Leader>1', 'yypVr='
    nmap '<Leader>2', 'yypVr-'

    #########
    # Visuals
    set :background, :dark
    colorscheme :solarized
    set :colorcolumn, 80

    set :statusline, '%<%f\\ ' +                    # Filename
                     '%w%h%m%r' +                   # Options
                     '%{fugitive#statusline()}' +   # Git Hotness
                     '%=%-7.(%l,%c%V%)\\ %p%%'      # Right aligned file nav info

    ################
    # Plugin Options
    let 'g:ctrlp_working_path_mode', 0


    ######
    # Misc
    set :autoindent
    set :smartindent
    set :shiftround
    set :joinspaces, false
    runtime! 'macros/matchit.vim'
    set :backupdir, '~/.vim-tmp'
    set :directory, '~/.vim-tmp'
    set :shortmess, :atI

  end

end

